#include <bits/stdc++.h>
using namespace std;


int main() {
    list<int> l;
    l.insert(l.begin(),1);
    l.insert(l.begin(), 1);
    l.insert(l.end(), 2);
    l.insert(l.end(), 2);
    cout << l.size() << endl; // 4
    l.remove(1); // 移除所有
    cout << l.size() << endl; // 2
    l.clear();
    l.push_front(3);
    l.push_front(4);
    l.push_front(5);
    l.push_front(5);
    l.push_front(5);
    l.push_front(5);
    l.erase(remove_if(l.begin(), l.end(), [&](int a) {
        return a == 4;
    }), l.end());
    cout << l.size() << endl;
    list<int> l2 = {2,3,4,5,6};
    list<int>::iterator it = l.begin();
    advance(it, 6);
    l2.splice(l2.end(), l, l.begin(), it);
    cout << "-------------------" << endl;
    for(auto a : l2) {
        cout << a << endl;
    }
}